﻿using HuangCanAPI.CustomAttribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace HuangCanAPI.Controllers
{
    [MVCAuthorize]

    public class HomeController : Controller
    {

        /// <summary>
        /// MVC控制器
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";

            return View();
        }

        [HttpGet]
        public ActionResult Login()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Login(string username, string password)
        {
            if (username == "admin" && password == "admin")
            {
                Session["username"] = "admin";
                return Content("登录成功");
            }
            else
            {
                return Content("登陆失败");
            }
        }

        public ActionResult Home()
        {
            return View();
        }


    }
}
